//这是第一种写法,利用了Map和优先级队列,但是太繁琐复杂并且容易出错,因此后续优化思路改用更简单的方法.
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        Map<String, Integer> map = new HashMap<>();
        PriorityQueue<Map.Entry<String, Integer>> maxHeap = new PriorityQueue(1,
        new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1,
                               Map.Entry<String, Integer> o2) {
                return o2.getValue() - o1.getValue();
            }
        }
        );
        String cur = "";
        for (int i = 0; i < str.length(); i++) {
            int sum = 0;
            while (i < str.length() && str.charAt(i) >= '0' && str.charAt(i) <= '9') {
                sum++;
                cur = cur + str.charAt(i);
                i++;
            }
            if (cur != "") {
                map.put(cur, sum);
            }
            cur = "";
        }
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            maxHeap.offer(entry);
        }
        String top = maxHeap.peek().getKey();
        System.out.print(top);
    }
}


//第二种解法 直接定义一个ret 与 cur进行比较即可
import java . util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System. in);
        String str = sc.nextLine();
        String ret = "";
        String cur = "";
        int i = 0;
        for (; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch >= '0' && ch <= '9') {
                cur = cur + ch + "";
            } else {
                if (ret.length() < cur.length()) {
                    ret = cur;
                }
                cur = "";
            }
        }
        // 处理123abc123456这种情况
        if (i == str.length() && ret.length() < cur.length()) {
            ret = cur;
        }
        System.out.print(ret);
    }
}



